package com.system.boot.setting.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.system.api.setting.entity.po.SysDict;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 字典目录
 *
 * @author: lslands
 * @version: 1.0
 * @create: 2024/5/18
 * @description:
 */
@Mapper
public interface DictMapper extends BaseMapper<SysDict> {

    /**
     * 查询编码是否重复
     * @param code 编码
     * @return boolean
     * @author lslands
     * @date 2024/5/16 00:39
     */
    @Select("SELECT EXISTS(SELECT 1 FROM sys_dict WHERE `code`=#{code})")
    boolean getExistsByCode(String code);


    /**
     * 批量(关联词条)删除(物理)
     * @param ids ids集 | [1,2,3,4,5]
     * @return int
     */
    int deleteBatch(@Param("ids") List<Long> ids);
}
